<main>
  <!-- <div class="panelgroup">
      <div class="panel-hd">
          <h3>订单动态</h3>
      </div>
      <div class="panel-bd">
          <nz-steps [nzCurrent]="1" [nzSize]="'small'" nzProgressDot>
              <nz-step nzTitle="买家下单" nzDescription="2020-12-15 20:24:58"></nz-step>
              <nz-step nzTitle="买家付款" nzDescription="2020-12-15 20:24:58"></nz-step>
              <nz-step nzTitle="商家发货" nzDescription="2020-12-15 20:24:58"></nz-step>
              <nz-step nzTitle="卖家收货" nzDescription="2020-12-15 20:24:58"></nz-step>
              <nz-step nzTitle="交易结束" nzDescription="2020-12-15 20:24:58"></nz-step>
          </nz-steps>
      </div>
  </div> -->
  <div class="panelgroup">
    <div class="panel-hd">
      <h3>订单信息</h3>
      <span class="channel-span">
                <ng-container *ngFor="let channelItem of channelSelects">
                    <nz-tag
                      *ngIf="channelItem.content == detailsData?.order.platform"
                      [nzColor]="channelItem.color">
                        {{ channelItem.name }}
                    </nz-tag>
                </ng-container>
            </span>
    </div>
    <div class="panel-bd">
      <ul>
        <li>
          <div class="key">
            <span>订单编号</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.orderNum ? detailsData?.order.orderNum : '-'}}</span>
          </div>
        </li>

        <li>
          <div class="key">
            <span>父订单</span>
          </div>
          <div class="val">
            <!-- <span>{{detailsData?.order.orderNum ? detailsData?.order.orderNum : '-'}}</span> -->
            <ng-container *ngIf="detailsData?.order?.parentOrderId;else templateFd">
              <a
                style="color: #1890ff;"
                target="_blank"
                [routerLink]="['/order/accDetails', detailsData?.order?.parentOrderId]">
                {{ detailsData?.order?.parentOrderNum || '-' }}
              </a>
            </ng-container>
            <ng-template #templateFd>-</ng-template>
          </div>
        </li>
        <li>
          <div class="key">
            <span>货主</span>
          </div>
          <div class="val">
            <!-- <span>{{detailsData?.order.orderNum ? detailsData?.order.orderNum : '-'}}</span> -->
            <ng-container *ngIf="detailsData?.order?.supplierName;else templateThz">
              <a
                style="color: #1890ff;"
                target="_blank"
                [routerLink]="['/stock/sqeAdd', detailsData?.order?.supplierId]">
                {{ detailsData?.order?.supplierName || '-' }}
              </a>
            </ng-container>
            <ng-template #templateThz>-</ng-template>
          </div>
        </li>

        <li>
          <div class="key">
            <span>订单状态</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.statusText}}</span>
            <nz-countdown *ngIf="detailsData?.order.countdown" [nzValue]="detailsData?.order.countdown"
                          [nzFormat]="'m 分 s 秒'"></nz-countdown>
          </div>
        </li>
        <li>
          <div class="key">
            <span>审核时间</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.auditTime ? detailsData?.order.auditTime : '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>审核状态</span>
          </div>
          <div class="val">
            <!-- <span>{{detailsData?.order.status == 3 ? '待审核' : detailsData?.order.status == 4 ? '审核不通过' :
                detailsData?.order.status >= 5 ? '审核通过' : '-'}}</span> -->
            <span>
                            <div [ngSwitch]="detailsData?.order?.auditState">
                                <div *ngSwitchCase="0">未审核</div>
                                <div *ngSwitchCase="1">已审核</div>
                                <div *ngSwitchCase="2">审核不通过</div>
                                <div *ngSwitchDefault>-</div>
                            </div>
                        </span>
          </div>
        </li>
      </ul>
      <ul>
        <li>
          <div class="key">
            <span>审核备注</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.auditDesc ? detailsData?.order.auditDesc : '-'}}</span>
          </div>
        </li>
      </ul>
      <ul>
        <li style="width: 100%;">
          <div class="key">
            <span>备注</span>
          </div>
          <div class="val">
                        <span>
                            {{ detailsData?.order.note }}
                          {{ detailsData?.order?.orderNote }}
                        </span>
          </div>
        </li>
      </ul>
    </div>
  </div>

  <div class="panelgroup">
    <div class="panel-hd">
      <h3>物流动态</h3>
    </div>
    <div class="panel-bd">
      <ul>
        <li>
          <div class="key">
            <span>公司名称</span>
          </div>
          <div class="val">
                        <span>{{ detailsData?.orderExpress.length != 0 ?
                          expressCode_To_Text(detailsData?.orderExpress[0].expressCode) : '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>快递单号</span>
          </div>
          <div class="val">
                        <span>{{ detailsData?.orderExpress.length != 0 ? detailsData?.orderExpress[0].expressNum :
                          '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>发货时间</span>
          </div>
          <div class="val">
            <span>{{ detailsData?.order.shipTime ? detailsData?.order.shipTime : '-'}}</span>
          </div>
        </li>
      </ul>
      <br>
      <nz-timeline *ngIf=" detailsData?.orderExpress.length != 0">
        <nz-timeline-item *ngFor="let item of detailsData?.orderExpress[0].expressTraces; let i=index;">
          <p style="padding-top:2px;font-size: 12px;color: #888;">{{item.time}}</p>
          <p style="margin-top:8px;font-size: 12px;">{{item.station}}
          </p>
        </nz-timeline-item>
      </nz-timeline>
    </div>
  </div>
  <!-- <div class="panelgroup">
      <div class="panel-hd">
          <h3>跟进信息</h3>
      </div>
      <div class="panel-bd">
          <nz-table #colSpanTable nzBordered [nzShowPagination]="false" [nzData]="[{}]">
              <thead>
                  <tr>
                      <th nzAlign="center">跟进时间</th>
                      <th nzAlign="center">跟进人</th>
                      <th nzAlign="center">跟进内容</th>
                  </tr>
              </thead>
              <tbody>
                  <tr>
                      <td nzAlign="center">1</td>
                      <td nzAlign="center">1</td>
                      <td nzAlign="center">1</td>
                  </tr>
                  <tr>
                      <td nzAlign="center">1</td>
                      <td nzAlign="center">1</td>
                      <td nzAlign="center">1</td>
                  </tr>
                  <tr>
                      <td nzAlign="center">1</td>
                      <td nzAlign="center">1</td>
                      <td nzAlign="center">1</td>
                  </tr>
              </tbody>
          </nz-table>
          <div class="commentBox">
              <input nz-input placeholder="请输入内容">
              <button nz-button nzType="primary">跟进</button>
          </div>
      </div>
  </div> -->

  <div class="panelgroup">
    <div class="panel-hd">
      <h3>收货人信息</h3>
      <span class="channel-span">
                <nz-tag [nzColor]="'#2db7f5'" *ngIf="detailsData?.order.userType == 2">B端</nz-tag>
                <nz-tag [nzColor]="'#87d068'" *ngIf="detailsData?.order.userType == 1">C端</nz-tag>
            </span>
    </div>
    <div class="panel-bd">
      <ul>
        <li>
          <div class="key">
            <span>收货人</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.consignee ? detailsData?.order.consignee : '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>联系电话</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.tel ? detailsData?.order.tel : '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>收货地址</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.address ? detailsData?.order.address : '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>收货时间</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.dealTime ? detailsData?.order.dealTime : '-'}}</span>
          </div>
        </li>
      </ul>
    </div>
  </div>
  <div class="panelgroup">
    <div class="panel-hd">
      <h3>买家信息</h3>
    </div>
    <div class="panel-bd">
      <ul>
        <li>
          <div class="key">
            <span>买家账号</span>
          </div>
          <div class="val">
            <span>
              <ng-container *ngIf="detailsData?.order.userId; else userTemplate">
                <a
                  style="color: #409EFF;"
                  target="_blank"
                  [routerLink]="['/customer/tabs', detailsData?.order.userId, 0]"
                >{{ detailsData?.order.userId }}</a>
              </ng-container>
              <ng-template #userTemplate>
                -
              </ng-template>
            </span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>买家电话</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.userPhone ? detailsData?.order.userPhone : '-'}}</span>
          </div>
        </li>
      </ul>
    </div>
  </div>

  <div class="panelgroup">
    <div class="panel-hd">
      <h3>收款信息</h3>
    </div>
    <div class="panel-bd">
      <ul>
        <li>
          <div class="key">
            <span>收款状态</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.payTime ? '已收款' : '未收款'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>应收总额</span>
          </div>
          <div class="val">
                        <span>{{detailsData?.order.totalPrice ? '￥' + (detailsData?.order.totalPrice | number : '0.2-2')
                          : '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>实收总额</span>
          </div>
          <div class="val">
                        <span>{{detailsData?.order.realPrice ? '￥' + (detailsData?.order.realPrice | number : '0.2-2') :
                          '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>运费</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.expressPrice ? '￥' + detailsData?.order.expressPrice : '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>付款方式</span>
          </div>
          <div class="val">
                        <span>
                            <i [ngStyle]="{'color': detailsData?.order?.payType | partsOrderPayType: 'color'}">
                                {{detailsData?.order?.payType | partsOrderPayType: 'label'}}
                            </i>
                            <ng-container *ngIf="detailsData?.order.payType === 6">
                                <span
                                  style="color: #409EFF; cursor: pointer;"
                                  class="p-l-5"
                                  (click)="transferVisible = true"
                                >查看</span>
                            </ng-container>
                        </span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>支付商家编号</span>
          </div>
          <div class="val">
                        <span>{{detailsData?.order.paymentMerchantNo ? detailsData?.order.paymentMerchantNo :
                          '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>付款时间</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.payTime ? detailsData?.order.payTime : '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>第三方流水号</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.payOrderNum ? detailsData?.order.payOrderNum : '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>爱豆</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.aiDouAmount || '0'}}元</span>
          </div>
        </li>
      </ul>
    </div>
  </div>


  <div class="panelgroup">
    <div class="panel-hd">
      <h3>退款信息</h3>
    </div>
    <div class="panel-bd">
      <ul>
        <li>
          <div class="key">
            <span>退款状态</span>
          </div>
          <div class="val">
            <span>{{refundState_To_Text(detailsData?.order.refundState)}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>售后截止时间</span>
          </div>
          <div class="val">
                        <span>{{detailsData?.order.afterSaleCloseTime ? detailsData?.order.afterSaleCloseTime :
                          '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>退款总额</span>
          </div>
          <div class="val">
                        <span>{{detailsData?.order.refundPrice ? '￥' + (detailsData?.order.refundPrice | number :
                          '0.2-2') : '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>我方承担运费</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.bearFreight ? '￥' + detailsData?.order.bearFreight : '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>爱豆</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.refundAiDouAmount || '0'}}个</span>
          </div>
        </li>
      </ul>
    </div>
  </div>


  <div class="panelgroup">
    <div class="panel-hd">
      <h3>优惠信息</h3>
    </div>
    <div class="panel-bd">
      <ul style="display: flex; flex-wrap: wrap;">
        <li>
          <div class="key">
            <span>优惠总额</span>
          </div>
          <div class="val">
                        <span>
                            ￥{{ (detailsData?.order.couponPrice + detailsData?.order.priceChange + detailsData?.order.favorablePostage + detailsData?.order.giftCardPrice + detailsData?.order.transferFavorablePrice) | number : '0.2-2'}}
                        </span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>优惠券</span>
          </div>
          <div class="val">
            <!-- <span *ngIf="(detailsData?.order.couponId && detailsData?.order.couponId != -1);else couponIdTemplate">
                {{detailsData?.order.favorablePrice ? '-￥' + detailsData?.order.favorablePrice : '-'}}
                <nz-tag>{{ detailsData?.order.couponName }}</nz-tag>
            </span>
            <ng-template #couponIdTemplate>-</ng-template> -->
            <span>{{ detailsData?.order.couponPrice ? '-￥' + detailsData?.order.couponPrice : '-' }}</span>
            <nz-tag *ngIf="detailsData?.order.couponName" class="m-l-6">{{ detailsData?.order.couponName }}</nz-tag>
          </div>
        </li>
        <!-- <li>
          <div class="key">
            <span>手动改价</span>
          </div>
          <div class="val">
            <span>{{detailsData?.order.priceChange ? '-￥' + detailsData?.order.priceChange : '-'}}</span>
          </div>
        </li> -->
        <li>
          <div class="key">
            <span>运费优惠</span>
          </div>
          <div class="val">
                        <span>{{detailsData?.order.favorablePostage ? '-￥' + detailsData?.order.favorablePostage :
                          '-'}}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>活动优惠</span>
          </div>
          <div class="val">
            <span>-</span>
          </div>
        </li>
        <!-- <li>
          <div class="key">
            <span>会员折扣</span>
          </div>
          <div class="val">
            <span>-</span>
          </div>
        </li> -->
        <li>
          <div class="key">
            <span>礼品卡</span>
          </div>
          <div class="val">
            <!-- <span *ngIf="(detailsData?.order.giftCardIds && detailsData?.order.giftCardIds != '-1');else giftCardIdsTemplate">{{detailsData?.order.favorablePrice ? '-￥' + detailsData?.order.favorablePrice : '-'}}</span>
            <ng-template #giftCardIdsTemplate>-</ng-template> -->
            <span>{{ detailsData?.order.giftCardPrice ? '-￥' + detailsData?.order.giftCardPrice : '-' }}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>促销活动</span>
          </div>
          <div class="val">
            <span>{{ detailsData?.order.promotionPrice ? '-￥' + detailsData?.order.promotionPrice : '-' }}</span>
          </div>
        </li>
        <li>
          <div class="key">
            <span>商家对公转账专属优惠</span>
          </div>
          <div class="val">
            <span>{{ detailsData?.order.transferFavorablePrice ? '￥' + detailsData?.order.transferFavorablePrice : '-' }}</span>
          </div>
        </li>
      </ul>
    </div>
  </div>


  <div class="panelgroup">
    <div class="panel-hd">
      <h3>商品信息</h3>
    </div>
    <div class="panel-bd">
      <div class="goodsTable">
        <div class="goodsHd">
          <ul>
            <li>商品信息</li>
            <li>购买数量</li>
            <li>购买单价</li>
            <li>小计</li>
            <li>优惠小计
              <i nz-icon nz-tooltip nzType="exclamation-circle" nzTheme="outline"
                 [nzTooltipTitle]="endTime" nzTooltipPlacement="top"></i>
              <ng-template #endTime>
                <span>优惠小计指的是当前行n个商品的一起的优惠金额</span>
              </ng-template>
            </li>
            <li>售后中数量</li>
            <li>
              已退货数量
              <i
                nz-icon
                nz-tooltip
                nzType="exclamation-circle"
                nzTheme="outline"
                nzTooltipTitle="退货退款成功以后增加"
              ></i>
            </li>
            <li>
              已售后数量
              <i
                nz-icon
                nz-tooltip
                nzType="exclamation-circle"
                nzTheme="outline"
                nzTooltipTitle="任何类型的售后成功以后增加"
              ></i>
            </li>
          </ul>
        </div>
        <div class="goodsCt">
          <div class="attr-box" *ngFor="let attrItem of detailsData?.order.list">
            <h3>{{ attrItem.groupName == 'item' ? '---' : attrItem.groupName }}</h3>
            <dl *ngFor="let goodsItem of attrItem.list">
              <dd>
                <img nz-image width="40px" height="40px" [nzSrc]="goodsItem.groupIcon" [nzFallback]="fallback" alt=""/>
                <a href=".#/goods/goodsTabs/{{goodsItem.goodsId}}" title="{{goodsItem.goodsName}}"
                   target="_blank">{{goodsItem.goodsName}}</a>
              </dd>
              <!-- 购买数量 -->
              <dd>x{{goodsItem.num}}</dd>
              <!-- 购买单价 -->
              <dd>￥{{goodsItem.price | number : '0.2-2'}}</dd>
              <!-- 小计 -->
              <dd>￥{{(goodsItem.num * goodsItem.price) | number : '0.2-2'}}</dd>
              <!-- 优惠小计 -->
              <!-- <dd>-</dd> -->
              <dd>￥{{goodsItem.favorablePrice | number : '0.2-2'}}</dd>
              <!-- 售后中数量 -->
              <dd>{{goodsItem.afterSaleNum || '-'}}</dd>
              <!-- 已退货数量 -->
              <dd>{{goodsItem.returnNum || '-'}}</dd>
              <!-- 已售后数量 -->
              <dd>{{goodsItem.returnTotal || '-'}}</dd>
            </dl>
          </div>
        </div>
        <div class="goodsTotal">
          <div class="attr-box">
            <dl>
              <dd><em>合计</em></dd>
              <!-- 购买数量 -->
              <dd>x{{ numSum }}</dd>
              <!-- 购买单价 -->
              <dd>-</dd>
              <!-- 小计 -->
              <dd>{{ subTotal == 0 ? '-' : '￥' + (subTotal | number : '0.2-2') }}</dd>
              <!-- 优惠小计 -->
              <dd>{{ favorablePriceSum == 0 ? '-' : '￥' + (favorablePriceSum | number : '0.2-2') }}</dd>
              <!-- 售后中数量 -->
              <dd>x</dd>
              <!-- 已退货数量 -->
              <dd>x</dd>
              <!-- 已售后数量 -->
              <dd>x</dd>
            </dl>
          </div>
        </div>
        <div class="goodsPrice">
          <div class="bt">
            <p>
              <em>运费 <font>
                {{ detailsData?.order.expressPrice ? '￥' + (detailsData?.order.expressPrice | number
                : '0.2-2') : '-'}}
              </font></em>
            </p>
            <p>
              <em>爱豆 <font>￥{{ detailsData?.order.aiDouAmount || '0'}}</font></em>
            </p>
            <!-- <p>
              <em>运费优惠 <font style="color: #008000;">
                {{ detailsData?.order.favorablePostage ? '-￥' + (detailsData?.order.favorablePostage
                | number : '0.2-2') : '-' }}
              </font></em>
            </p> -->
            <p>
              <em>
                商家对公转账专属优惠
                <font>
                  {{ detailsData?.order.transferFavorablePrice ? '￥' + (detailsData?.order.transferFavorablePrice | number : '0.2-2') : '-' }}
                </font>
              </em>
            </p>
            <p>
              <em>实际总额 <font style="color: #f00;">{{ detailsData?.order.realPrice ? '￥'
                + (detailsData?.order.realPrice | number : '0.2-2') :
                '-' }}</font></em>
            </p>
          </div>
        </div>
      </div>
    </div>

    <div class="panel-hd">
      <h3>以旧换机-旧机信息</h3>
    </div>
    <div class="panel-bd">
      <nz-table
        #oldDeviceTable
        nzSize="small"
        nzBordered
        [nzShowPagination]="false"
        [nzData]="detailsData?.i5RecycleOrderList">
        <thead>
          <tr>
            <th nzAlign="center">
              <span>机器信息</span>
            </th>
            <th nzAlign="center">报价信息</th>
            <th nzAlign="center">订单号</th>
          </tr>
        </thead>

        <tbody>
          <tr *ngFor="let data of oldDeviceTable.data">
            <td nzAlign="center">
              <span>{{data.umname}}</span>
            </td>

            <td nzAlign="center">
              <ng-container *ngIf="detailsData?.status === 0; else syTemplate">
                预估回收报价：￥ {{ (data.uprc || 0) + (data.orderAprc || 0) }}
              </ng-container>
              <ng-template #syTemplate>
                实际回收报价：￥ {{ (data.bprc || 0) + (data.aprc || 0) }}
              </ng-template>
            </td>

            <td nzAlign="center">
              <a
                style="color: #40a9ff"
                target="_blank"
                routerLink="/aisi-recyc/loveOrderManage"
                [queryParams]="{okey: data.okey}"
              >{{data.okey}}</a>
            </td>
          </tr>

          <tr *ngIf="detailsData?.i5RecycleOrderList?.length">
            <td colSpan="3" nzAlign="right">
              <div class="order-machine-sum">
                <p>
                  <span>
                    {{detailsData?.status === 0 ? '预估回收款总计：' : '实际回收款总计：'}}
                  </span>
                  <span>￥{{ detailsData?.status === 0 ? (detailsData?.uprcSum || 0) : (detailsData?.tprcSum || 0) }}</span>
                </p>
  
                <p class="p-t-10">
                  <nz-tag nzColor="error">{{ subsidyStatus[detailsData?.status] }}</nz-tag>
                  
                  <i
                    nz-icon
                    nzType="exclamation-circle"
                    nzTheme="outline"
                    nz-popover
                    nzPopoverTitle="补贴规则"
                    [nzPopoverContent]="btContentTemplate"
                  ></i>
                  <ng-template #btContentTemplate>
                    <ul>
                      <li *ngFor="let item of subsidyRuleList">
                        旧机回收总价满 <b>{{ item.price }}</b> 元，补贴 <b>{{ item.allowance }}</b> 元
                      </li>
                    </ul>
                    <p class="p-t-10">如符合多个门槛，则只享受最高那档补贴，补贴金额计算以旧机实际回收价为准</p>
                  </ng-template>
  
                  <span>
                    {{detailsData?.status === 0 ? '以旧换机预估补贴：' : '以旧换机实际补贴：'}}
                  </span>
                  <span>￥{{ detailsData?.status === 0 ? (detailsData?.uprcSubsidy || 0) : (detailsData?.tprcSubsidy || 0) }}</span>
                </p>
              </div>
            </td>
          </tr>
        </tbody>
      </nz-table>
    </div>

    <!-- 子订单信息 -->
    <div class="panel-hd">
      <h3>子订单信息</h3>
    </div>
    <div class="panel-bd">
      <nz-table
        #orderChildTable
        nzSize="small"
        nzBordered
        [nzShowPagination]="false"
        [nzData]="detailsData?.oldList">
        <thead>
          <tr>
            <th nzAlign="center">订单编号</th>
            <th nzAlign="center">状态</th>
            <th nzAlign="center">货主</th>
            <th nzAlign="center">操作</th>
          </tr>
        </thead>

        <tbody>
          <tr *ngFor="let data of orderChildTable.data">
            <td nzAlign="center">
              <ng-container *ngIf="data.id;else templatexFd">
                <a
                  style="color: #1890ff;"
                  target="_blank"
                  [routerLink]="['/order/accDetails', data?.id]">
                  {{ data.orderNum || '-' }}
                </a>
              </ng-container>
              <ng-template #templatexFd>-</ng-template>
            </td>

            <td nzAlign="center" class="{{ getStatusColor(data.status) }}">
              {{ status_To_Text(data.status) }}
            </td>

            <td nzAlign="center">
              <ng-container *ngIf="data?.supplierId;else templateThzs">
                <a
                  style="color: #1890ff;"
                  target="_blank"
                  [routerLink]="['/stock/sqeAdd', data?.supplierId]">
                  {{ data.supplierName || '-' }}
                </a>
              </ng-container>
              <ng-template #templateThzs>-</ng-template>
            </td>

            <td nzAlign="center">
              <a nz-button nzType="link" nzBlock (click)="followModal(data.orderNum, '2')">跟进信息</a>
            </td>
          </tr>
        </tbody>
      </nz-table>
    </div>

    <!-- 售后信息 -->
    <h3 class="acc-title">售后信息</h3>
    <nz-table
      #groupingTable
      nzBordered
      [nzData]="detailsData?.orderRefunds"
      [nzShowPagination]="false"
      nzSize="middle">
      <thead>
        <tr>
          <th rowspan="3" nzAlign="center">申请时间</th>
          <th rowspan="3" nzAlign="center">当前状态</th>
          <th rowspan="3" nzAlign="center">售后单号</th>
          <th style="width: 80px;" nzAlign="center">退款成功总额</th>
          <th rowspan="3" nzAlign="center">操作</th>
        </tr>
      </thead>

      <tbody>
        <ng-container *ngFor="let item of detailsData?.orderRefunds;">
          <tr>
            <!-- 申请时间 -->
            <td nzAlign="center">{{item.createTime || '-'}}</td>
            <!-- 当前状态 -->
            <td nzAlign="center">{{saleStatic_to_text(item.status)}}</td>
            <!-- 售后单号 -->
            <td nzAlign="center">{{item.returnNum || '-'}}</td>
            <!-- 退款成功总额 -->
            <td nzAlign="right"> ￥{{item.refundPrice}}</td>
            <!-- 操作 -->
            <td nzAlign="center">
              <a nz-button nzType="link" nzBlock (click)="followModal(item.returnNum, '2')">跟进信息</a>
            </td>
          </tr>
        </ng-container>
        <ng-container>
          <tr>
            <td nzAlign="center">合计</td>
            <td nzAlign="center" colSpan="2"></td>
            <td nzAlign="right">￥{{cecheData.tatalCount}}</td>
            <td nzAlign="center"></td>
          </tr>
        </ng-container>
      </tbody>
    </nz-table>
    <app-follow-component #appFollowComponent *ngIf="detailsData?.order?.orderNum" [id]="detailsData?.order?.orderNum"
                          type="1">
    </app-follow-component>
  </div>

  <div class="submit-box">
    <nz-divider></nz-divider>
    <div class="bt-box">
      <button
        nz-button
        *ngIf="detailsData?.order.status == '5' || detailsData?.order.status == '6' || detailsData?.order.status == '7'"
        nzType="primary"
        [disabled]="detailsData?.order.childCount > 0"
        [nzLoading]="cancelLoading"
        (click)="cannelOrderModal(detailsData?.order.id)">
        取消订单
      </button>
      <button nz-button nzType="primary" (click)="followModal(detailsData?.order.orderNum, '1')">跟进</button>
      <button nz-button nzType="primary" (click)="modifyPriceModal()" [disabled]="true">改价</button>
      <button
        nz-button
        nzType="primary"
        (click)="showModal()"
        *ngIf="permissionService.userPermission.has('order:parts:saleRefund')"
        [disabled]="detailsData?.order.childCount || detailsData?.order.status != '9'">
        售后退款
      </button>
      <button nz-button nzType="primary" (click)="extendTimeModal()"
              *ngIf="permissionService.userPermission.has('order:parts:saleExtend')"
              [disabled]="detailsData?.order.status != '9'">延长售后日期
      </button>
      <app-bt-group [btType]="'default'" [btText]="'返回'"></app-bt-group>
    </div>
  </div>
</main>


<nz-modal [(nzVisible)]="refundVisible" nzTitle="售后退款" (nzOnCancel)="handleCancel()" [nzFooter]="null">
  <ng-container *nzModalContent>
    <p class="sale-after-tips" *ngIf="detailsData?.order?.renewalNo">※ 温馨提示：当前订单是以旧换机订单，请确认核对换机补贴再退款</p>
    <nz-form-item>
      <nz-form-label [nzSpan]="6">退款金额(元)</nz-form-label>
      <nz-form-control [nzSpan]="14">
        <nz-input-number [nzMin]="1" [(ngModel)]="entityParam.refundPrice" nzPlaceHolder="请输入退款金额">
        </nz-input-number>
      </nz-form-control>
    </nz-form-item>
    <nz-form-item>
      <nz-form-label [nzSpan]="6">我方承担运费(元)</nz-form-label>
      <nz-form-control [nzSpan]="14">
        <nz-input-number [nzMin]="0" [(ngModel)]="entityParam.bearFreight" nzPlaceHolder="请输入我方承担运费">
        </nz-input-number>
      </nz-form-control>
    </nz-form-item>
    <nz-form-item>
      <nz-form-control [nzSpan]="8" [nzOffset]="6">
        <button nz-button nzType="primary" (click)="affirmModal()">确认</button>
        &nbsp;
        <button nz-button nzType="default" (click)="handleCancel()">取消</button>
      </nz-form-control>
    </nz-form-item>
    PS:
    <br>
    1：确认以后，该订单会直接将填写的款项原路退回到用户账户
    <br>
    2：请提前做好备注记录，不要胡乱操作，避免造成损失
    <br>
    3：用户实际收到金额为“退款金额”中所填写得金额
  </ng-container>
</nz-modal>

<nz-modal [(nzVisible)]="affirmVisible" nzTitle="再次确认" (nzOnCancel)="affirmCancel()" [nzFooter]="null">
  <ng-container *nzModalContent>
    <nz-form-item>
      <nz-form-label [nzSpan]="4">提示</nz-form-label>
      <nz-form-control [nzSpan]="19">
        请输入“确认退款”文字，然后点击确认来完成最终退款操作；
      </nz-form-control>
    </nz-form-item>
    <nz-form-item>
      <nz-form-label [nzSpan]="4">是否退款</nz-form-label>
      <nz-form-control [nzSpan]="14">
        <input nz-input placeholder="请输入“确认退款”文字" [(ngModel)]="affirmText"/>
      </nz-form-control>
    </nz-form-item>
    <nz-form-item>
      <nz-form-control [nzSpan]="18" [nzOffset]="4">
        <button nz-button nzType="primary" (click)="confirmRefund()">退款({{(entityParam.refundPrice +
          entityParam.bearFreight)}}元)
        </button>
        &nbsp;
        <button nz-button nzType="default" (click)="affirmCancel()">取消</button>
      </nz-form-control>
    </nz-form-item>
    PS:
    <br>
    1：点击确认以后，该订单会直接将填写的款项原路退回到用户账户
  </ng-container>
</nz-modal>

<nz-modal [(nzVisible)]="extendTimeVisible" nzTitle="售后延期" (nzOnCancel)="handleCancel()" [nzFooter]="null">
  <ng-container *nzModalContent>
    <nz-form-item>
      <nz-form-label [nzSpan]="5">延长售后日期</nz-form-label>
      <nz-form-control [nzSpan]="14">
        <nz-date-picker [(ngModel)]="entityParam.afterSaleCloseTime"></nz-date-picker>
      </nz-form-control>
    </nz-form-item>
    <nz-form-item>
      <nz-form-control [nzOffset]="5">
        <button nz-button nzType="primary" (click)="extendTimeConfirm()">确定</button>
        &nbsp;&nbsp;
        <button nz-button nzType="default" (click)="handleCancel()">取消</button>
      </nz-form-control>
    </nz-form-item>
  </ng-container>
</nz-modal>

<nz-modal [(nzVisible)]="modifyPriceVisible" nzTitle="订单改价" (nzOnCancel)="handleCancel()" [nzFooter]="null"
          [nzWidth]="1000">
  <ng-container *nzModalContent>
    <nz-form-item>
      <nz-form-label [nzSpan]="3">订单优惠</nz-form-label>
      <nz-form-control>
        <nz-row [nzGutter]="16">
          <nz-col [nzSpan]="3">
            <nz-statistic [nzValue]="'￥'+ detailsData?.order.totalPrice" [nzTitle]="'应付总额'"></nz-statistic>
          </nz-col>
          <nz-col [nzSpan]="4">
            <nz-statistic [nzValue]="'￥'+ (detailsData?.order.favorablePrice + detailsData?.order.priceChange +
                        detailsData?.order.favorablePostage)" [nzTitle]="'其他优惠总额'"></nz-statistic>
          </nz-col>
          <nz-col [nzSpan]="5">
            <nz-statistic [nzValue]="''" [nzTitle]="'优惠额度'" [nzPrefix]="prefixTplOne"></nz-statistic>
            <ng-template #prefixTplOne>
              <nz-input-number [nzMin]="0.01" [(ngModel)]="modifyPriceParam.priceChange"
                               nzPlaceHolder="请输入优惠额度" [nzStep]="1"></nz-input-number>
            </ng-template>
          </nz-col>
          <nz-col [nzSpan]="5">
            <nz-statistic [nzValue]="'￥'+ (detailsData?.order.totalPrice -  (detailsData?.order.favorablePrice + detailsData?.order.priceChange +
                        detailsData?.order.favorablePostage) - modifyPriceParam.priceChange)" [nzTitle]="'用户实际需要支付金额'">
            </nz-statistic>
          </nz-col>
        </nz-row>

      </nz-form-control>
    </nz-form-item>
    <nz-form-item>
      <nz-form-label [nzSpan]="3">邮费优惠</nz-form-label>
      <nz-form-control>
        <nz-row [nzGutter]="16">
          <nz-col [nzSpan]="3">
            <nz-statistic [nzValue]="'￥'+ detailsData?.order.expressPrice" [nzTitle]="'应付邮费'"></nz-statistic>
          </nz-col>
          <nz-col [nzSpan]="5">
            <nz-statistic [nzValue]="''" [nzTitle]="'优惠额度'" [nzPrefix]="prefixTplOne1"></nz-statistic>
            <ng-template #prefixTplOne1>
              <nz-input-number [nzMin]="0.01" [(ngModel)]="modifyPriceParam.favorablePostage"
                               nzPlaceHolder="请输入优惠额度" [nzStep]="1" [disabled]="true"></nz-input-number>
            </ng-template>
          </nz-col>
          <nz-col [nzSpan]="5">
            <nz-statistic [nzValue]="'￥'+ (detailsData?.order.expressPrice - modifyPriceParam.favorablePostage)"
                          [nzTitle]="'用户实际需要支付邮费'"></nz-statistic>
          </nz-col>
        </nz-row>
      </nz-form-control>
    </nz-form-item>
    <nz-form-item>
      <nz-form-control [nzOffset]="3">
        <button nz-button nzType="primary" (click)="modifyPriceConfirm()">确定</button>
        &nbsp;&nbsp;
        <button nz-button nzType="default" (click)="handleCancel()">取消</button>
      </nz-form-control>
    </nz-form-item>
  </ng-container>
</nz-modal>

<nz-modal *ngIf="followVisible" [(nzVisible)]="followVisible" nzTitle="跟进" (nzOnCancel)="handleCancel()"
          [nzFooter]="null" [nzWidth]="'1050px'">
  <ng-container *nzModalContent>
    <div class="importBox">
            <textarea rows="6" nz-input [(ngModel)]="followParam.content" placeholder="请输入内容，限制100字"
                      [maxlength]="100"></textarea>
      <div class="bt-box">
        <label for="file" class="followFile">
          <span>选择文件</span>
          <input id="file" type="file" multiple="multiple" [(ngModel)]="inputVal"
                 (change)="handleFileInput($event,2)">
        </label>
        <font>请选择图片、office文件、PDF文件</font>
        <button nz-button nzType="primary" (click)="followerSave()">提交</button>
      </div>
      <ul>
        <li *ngFor="let item of followParam.enclosure; index as i">
          <span>{{item.showUrl}}</span>
          <a nz-button nz-button-tdlink nzType="link" (click)="deleteFollowImg(i)">删除</a>
        </li>
      </ul>
    </div>
    <app-follow-component *ngIf="followParam.relationInformation" [id]="followParam.relationInformation"
                          [type]="followParam.type">
    </app-follow-component>
    <!-- <div class="followTable" *ngIf="followList.length != 0">
        <h3>跟进记录</h3>
        <br>
        <nz-table #colSpanTable nzBordered [nzShowPagination]="false" [nzData]="[{}]">
            <thead>
                <tr>
                    <th nzAlign="center">id</th>
                    <th nzAlign="center">跟进时间</th>
                    <th nzAlign="center">跟进人</th>
                    <th nzAlign="center">跟进内容</th>
                    <th nzAlign="center">附件</th>
                </tr>
            </thead>
            <tbody>
                <tr *ngFor="let item of followList">
                    <td nzAlign="center">{{item.id}}</td>
                    <td nzAlign="center">{{item.createTime}}</td>
                    <td nzAlign="center">{{item.follower}}</td>
                    <td nzAlign="center">{{item.content}}</td>
                    <td nzAlign="center">
                        <ul>
                            <li *ngFor="let o of item.enclosure">
                                <span>{{formUrl(o)}}</span>
                                <a href="{{o}}">下载</a>
                            </li>
                        </ul>
                    </td>
                </tr>
            </tbody>
        </nz-table>
    </div> -->
  </ng-container>
</nz-modal>

<!-- S 对公转账信息 -->
<nz-modal
  [(nzVisible)]="transferVisible"
  nzTitle="对公转账信息"
  [nzFooter]="null"
  (nzOnCancel)="transferVisible = false">
  <ng-container *nzModalContent>
    <p class="transfer-modal-tital">
      对公转账信息
      <button
        nz-button
        nzType="link"
        nzSize="small"
        nz-tooltip
        nzTooltipTitle="点击复制"
        (click)="transferInofoCopy()"
      >一键复制
      </button>
    </p>
    <dl class="transfer-modal-dl">
      <dd>
        <span class="modal-dl-lab">户名</span>
        <span class="modal-dl-val">{{ transferInfo?.userName || '-' }}</span>
      </dd>
      <dd>
        <span class="modal-dl-lab">开户行</span>
        <span class="modal-dl-val">{{ transferInfo?.bankName || '-' }}</span>
      </dd>
      <dd>
        <span class="modal-dl-lab">账户</span>
        <span class="modal-dl-val">{{ transferInfo?.bankAccount || '-' }}</span>
      </dd>
      <dd>
        <span class="modal-dl-lab">联行号</span>
        <span class="modal-dl-val">{{ transferInfo?.cnaps || '-' }}</span>
      </dd>
      <dd>
        <span class="modal-dl-lab">汇款识别码</span>
        <span class="modal-dl-val">{{ transferInfo?.transferCode || '-' }}</span>
      </dd>
    </dl>

    <p class="transfer-modal-tital p-t-5">注意事项（转账必读）</p>

    <dl class="transfer-modal-tips">
      <dd>1、下单后请尽快转账，一个识别码对应一个订单和金额，务必保证账金额与订单金额一致，请勿多转、少转和分次转账，否则影响订单对账进度，10天内未对账系统自动取消订单;</dd>
      <dd>2、汇款时将汇款识别码填写至汇款单“用途/备注/摘要"等栏，此识别码务必填写正确，请勿增加其他文字说明，便于快速核销款项</dd>
    </dl>
  </ng-container>
</nz-modal>
<!-- E 对公转账信息 -->
